package com.lagou.service;

import com.lagou.pojo.Article;
import com.lagou.repository.ArticleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl implements  ArticleService {

    @Autowired
    private ArticleRepository articleRepository;

    @Override
    public Page<Article> findByPage(Integer pageNum, Integer pageSize) {

        PageRequest of=PageRequest.of(pageNum,pageSize);
        Page<Article> page=articleRepository.findByPage(of);
        return page;
    }
}
